package com.github.shiqiyue.app.api.sapi.result.department;


import com.github.shiqiyue.app.common.entity.TreeNode;
import com.github.shiqiyue.app.modules.sys.entity.Department;
import com.github.shiqiyue.app.modules.sys.entity.Permission;
import lombok.Data;

import java.util.List;

/***
 * 部门树VO
 * @author wenyao.wu
 * @date 2018/10/15
 */
@Data
public class DepartmentTreeDTO implements TreeNode {

    private Long id;

    /**
     * 名称
     */
    private String name;


    /****
     * 上级权限id
     */
    private Long pid;


    private List<DepartmentTreeDTO> children;

    public DepartmentTreeDTO() {
    }

    public static DepartmentTreeDTO newInstance(Department department) {
        DepartmentTreeDTO departmentTreeDTO = new DepartmentTreeDTO();
        departmentTreeDTO.setId(department.getId());
        departmentTreeDTO.setName(department.getName());
        departmentTreeDTO.setPid(department.getPid());
        return departmentTreeDTO;
    }

    @Override
    public void setChildren(List children) {
        this.children = children;
    }


}
